import {
	HTTP
} from '../utils/http.js'
let http = new HTTP()


export const getUserInfo = (data) => {
	return http.request({
		url: 'API/Users/GetWxUserInfo',
		method: 'POST',
		data
	})
}


export const getweixinUserInfo = (data) => {
	return http.request({
		url: 'Api/SmallWeiXin/CheckToken',
		method: 'POST',
		data
	})
}

/*
	获取站点数据
 */
export const useSiteDataApi = (parentId) => {
	return http.request({
		url: 'API/Article/GetArticleCategoryList',
		method: 'POST',
		data: {
			parentId
		}
	})
}

// 获取文章数据
export const useArticleApi = (data) => {
	return http.request({
		url: 'API/Article/GetList',
		method: 'POST',
		data
	})
}

export const useActiveApi = (data) => {
	return http.request({
		url: '/API/Product/GetList',
		method: 'POST',
		data
	})
}


/*
	首页数据
 */
export const getHomeMsg = (data) => {
	return http.request({
		url: 'API/Article/GetArticleCategoryList',
		method: 'POST',
		data
	})
}
//文章评论列表
export const getArticleCommentList = (data) => {
	return http.request({
		url: 'API/Article/GetArticleCommentList',
		method: 'POST',
		data
	})
}
//新增文章评论
export const addArticleComment = (data) => {
	return http.request({
		url: 'API/Article/AddArticleComment',
		method: 'POST',
		data
	})
}
// 获取文章列表
export const getChildren = (data) => {
	return http.request({
		url: 'API/Article/GetList',
		method: 'POST',
		data
	})
}

// 获取文章详情
export const getArticleDetail = (data) => {
	return http.request({
		url: 'API/Article/GetDetail',
		method: 'POST',
		data
	})
}
//文章点赞
export const AddUpvote = (data) => {
	return http.request({
		url: 'API/Article/AddUpvote',
		method: 'POST',
		data
	})
}
//是否点赞
export const CheckUpVote = (data) => {
	return http.request({
		url: 'API/Article/CheckUpVote',
		method: 'POST',
		data
	})
}
// 取消点赞
export const CancelUpvote = (data) => {
	return http.request({
		url: 'API/Article/CancelUpvote',
		method: 'POST',
		data
	})
}
//是否收藏
export const getCheckCollection = (data) => {
	return http.request({
		url: 'API/Users/CheckCollection',
		method: 'POST',
		data
	})
}
//收藏文章
export const getAddCollection = (data) => {
	return http.request({
		url: 'API/Users/AddCollection',
		method: 'POST',
		data
	})
}
//取消收藏
export const getCancelCollection = (data) => {
	return http.request({
		url: 'API/Users/CancelCollection',
		method: 'POST',
		data
	})
}
//取消收藏
export const footprint = (data) => {
	return http.request({
		url: 'API/Footprint/Add',
		method: 'POST',
		data
	})
}
//宝贝收藏列表
export const getProductCollection = (data) => {
	return http.request({
		url: 'API/Users/GetProductCollectionList',
		method: 'POST',
		data
	})
}

//商家收藏列表
export const getBusinessCollection = (data) => {
	return http.request({
		url: 'API/Users/GetBusinessCollectionList',
		method: 'POST',
		data
	})
}

// 添加投诉
export const addComplaint = (data) => {
	return http.request({
		url: 'API/Users/AddFeedback',
		method: 'POST',
		data
	})
}

// 获取用户消息
export const getNews = (data) => {
	return http.request({
		url: 'API/Users/GetUserMessageList',
		method: 'POST',
		data
	})
}

// 获取用户数据
export const getUserId = (data) => {
	return http.request({
		url: 'API/Users/ThisDetail',
		method: 'POST',
		data
	})
}

// 获取用户评论
export const getEvaluations = (data) => {
	return http.request({
		url: 'API/Users/GetUserEvaluations',
		method: 'POST',
		data
	})
}

// 获取用户投诉
export const getComplaint = (data) => {
	return http.request({
		url: 'API/Users/MyComplaintList',
		method: 'POST',
		data
	})
}
// 获取用户投诉
export const getAdvice = (data) => {
	return http.request({
		url: 'API/Users/MyAdviceList',
		method: 'POST',
		data
	})
}
//已读某一个
export const readMsgNews = (data) => {
	return http.request({
		url: 'API/Users/SetUserMessageIsRead',
		method: 'POST',
		data
	})
}

//一键阅读
export const readAllNews = (data) => {
	return http.request({
		url: 'API/Users/SetAllMessageIsRead',
		method: 'POST',
		data
	})
}

// 获取用户历史积分
export const getUserIntegralList = (data) => {
	return http.request({
		url: 'API/Marketing/GetUserPointList',
		method: 'POST',
		data
	})
}
// 获取用户积分
export const getUserIntegral = (data) => {
	return http.request({
		url: 'API/Marketing/GetUsersPoints',
		method: 'POST',
		data
	})
}

// 获取用户vip信息
export const getUserVip = (data) => {
	return http.request({
		url: 'API/Marketing/GetUserMemberTags',
		method: 'POST',
		data
	})
}
//获取优惠券
export const GetAvailableCoupons = (data) => {
	return http.request({
		url: 'API/Marketing/GetAvailableCoupons',
		method: 'POST',
		data
	})
}

//用户领取优惠券
    // "CouponTempleId": 1,
    // "ReceivingMethod": 2,   1为领取 2为积分兑换
    // "ExchangePoint": 3     积分兑换所需积分 
export const GetUserReceiveCoupons = (data) => {
	return http.request({
		url: 'API/Marketing/UserReceiveCoupons',
		method: 'POST',
		data
	})
}
// 获取用户的优惠券
export const GetUserCoupons = (data) => {
	return http.request({
		url: 'API/Marketing/GetUserCoupons',
		method: 'POST',
		data
	})
}

// 获取用户的身份码
export const GetUserIDQrCode = (data) => {
	return http.request({
		url: 'API/Users/GetUsersIDQrCode',
		method: 'POST',
		data
	})
}

